<example name="HTTP service">
  <file type="html">
    <div id="output"></div>
  </file>

  <file type="js">
    import Auth from '@jetbrains/ring-ui/components/auth/auth';
    import hubConfig from 'ring-ui-docs/components/hub-config';
    import HTTP from '@jetbrains/ring-ui/components/http/http';

    const auth = new Auth(hubConfig);
    const http = new HTTP(auth);

    async function initializeExample() {
      await auth.init();

      const user = await http.get(`${hubConfig.serverUri}/api/rest/users/me?fields=name,login`);

      document.querySelector('#output').innerText = JSON.stringify(user);
    }

    initializeExample();

  </file>
</example>
